package com.har.modules.web.controller;

import com.har.common.utils.R;
import com.har.modules.web.entity.CompanyEntity;
import com.har.modules.web.entity.CompanyRegisterEntity;
import com.har.modules.web.entity.UserEntity;
import com.har.modules.web.entity.UserRegisterEntity;
import com.har.modules.web.service.CompanyService;
import com.har.modules.web.service.UserRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * 注册
 *
 * @author maorui
 *
 */
@RestController
@RequestMapping("/register")
public class RegisterController {

    @Autowired
    private UserRegisterService userRegisterService;

    @Autowired
    private CompanyService companyService;

    /**
     * 企业员工注册
     *
     * @param userRegisterEntity
     * @return
     */
    @RequestMapping("/user")
    public R saveuser(@RequestBody UserRegisterEntity userRegisterEntity) throws ParseException {
        UserEntity user=userRegisterService.save(userRegisterEntity);
        return R.ok();
    }

    /**
     *  企业注册
     *
     * @param companyRegisterEntity
     * @return
     */
    @RequestMapping("/company")
    public R savecompany(@RequestBody CompanyRegisterEntity companyRegisterEntity) throws ParseException {
        CompanyEntity companyEntity=companyService.save(companyRegisterEntity);
        return R.ok();
    }

}
